<script setup>
// @ts-nocheck

import { useRouter } from "vue-router";
import { defineProps } from "vue";
const router = useRouter();
const props = defineProps({
  panelData: {
    required: true,
  },
});
const goGoodFn = (id) => {
  router.push(`/goods/${id}`);
};
</script>

<template>
  <div class="panelWrapper">
    <div class="panelTitle">
      <div class="panelTitleLeft">
        <div class="title">
          <slot name="title" />
        </div>
        <span class="desc">
          <slot name="desc" />
        </span>
      </div>
      <div class="panelTitleRight">
        <slot name="rightTitle" />
      </div>
    </div>
    <div class="panelContent">
      <div
        class="panelItem"
        v-for="item in panelData"
        :key="item.id"
        @click="goGoodFn(item.id)"
      >
        <img :src="item.picture" alt="" style="width: 306px" />
        <div class="panelBottomWrapper">
          <div class="panelBottomTitle" v-if="item.bottom1">
            {{ item.bottom1 }}
          </div>
          <div class="panelPrice" v-if="item.bottom2">{{ item.bottom2 }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="less" scoped>
.panelWrapper {
  margin-left: 100px;
  margin-top: 20px;
  margin-right: 100px;
  .panelTitle {
    display: flex;
    justify-content: space-between;
    margin-right: 180px;
    .panelTitleLeft {
      display: flex;
      align-items: center;
      .title {
        font-size: 24px;
        font-weight: 700;
      }
      .desc {
        margin-left: 10px;
        color: #999;
        font-size: 14px;
      }
    }
  }
  .panelContent {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    .panelItem {
      width: 306px;
      margin-left: 10px;
      margin-top: 10px;
      .panelBottomWrapper {
        background-color: #f0f9f4;
        display: flex;
        flex-direction: column;
        align-items: center;
        .panelBottomTitle {
          margin-top: 10px;
          font-size: 20px;
          margin-left: 15px;
          margin-right: 15px;
        }
        .panelPrice {
          margin-top: 10px;
          font-size: 20px;
          // color: red;
        }
      }
      &:hover {
        transform: translate3d(0, -3px, 0);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
        cursor: pointer;
      }
    }
  }
}
</style>
